package com.itheima.dao;

import com.itheima.pojo.Book;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface BookDao {
    //quan bu
    @Select("select * from tbl_book")
    List<Book> findAll();
    //cha id
    @Select("select * from tbl_book where id = #{id}")
    Book findById(Integer id);
    //zeng
    @Insert("insert into tbl_book (id, type, name, description) VALUES (null,#{type},#{name},#{description})")
    int save(Book book);
    //shan
    @Delete("delete from tbl_book where id = #{id}")
    int delete(Integer id);
    //gai
    @Update("update tbl_book set type=#{type},name=#{name},description=#{description} where id =#{id}")
    int update(Book book);
}
